package com.example.controller;

import com.example.common.Result;
import com.example.entity.Employee;
import com.example.entity.Student;
import com.example.service.EmployeeService;
import com.example.service.StudentService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class WebController {

    @Resource
    private EmployeeService employeeService ;

    @Resource
    private StudentService studentService;

    @PostMapping("/login")
    public Result login(@RequestBody Employee employee) {
        Employee dbemployee = employeeService.login(employee);
        return Result.success(dbemployee);
    }

    @PostMapping("/loginStudent")
    public Result loginStudent(@RequestBody Student student) {
        Student dbstudent = studentService.login(student);
        return Result.success(dbstudent);
    }
}
